package edu.nakan.sortnumbers;

import java.lang.reflect.Array;

/**
 * @author NakanPhung
 * @date: 7/19/2013
 * @email: cank56hua@gmail.com
 * @project: HomeWorkDay2Problem3
 **/

/*
The Algorithm to sort the increasing array
	for(int i=0; i<n; i++ ){
		for(int j=i+1; j<n; j++){
			if(a[i] > a[j]){
				int temp = a[i];
				a[i] = a[j];
				a[j] = temp;
			}
		}
	}	
*/


public class SortNumber {
	
	public static void main(String[] args) {
		
		int[] arrayNumber ={1,3,4,2,5,6};
		int lengthArray = Array.getLength(arrayNumber);
				
		// To sort increasing numbers in the array
		
		for(int i=0; i<lengthArray; i++){
			for(int j= i+1;j<lengthArray; j++ ){
				if(arrayNumber[i]> arrayNumber[j]){
					int temp = arrayNumber[i];
					arrayNumber[i] = arrayNumber[j];
					arrayNumber[j] = temp;
				}
			}
		}
		
		// To print the increasing number in the array	
		System.out.print("The array in an increasing order: ");
		for(int i = 0; i<lengthArray;i++){
			System.out.print(arrayNumber[i]+" ");
		}
				
	}
	
}
